<?php

namespace App\Http\Requests;

/**
 * @OA\Schema(
 *     required={"nickname","avatar","mobile"}
 * )
 */
class UserRegister extends BaseRequest
{

    /**
     * @OA\Property(property="nickname",format="string",description="昵称",example=""),
     * @OA\Property(property="avatar",format="string",description="头像",example=""),
     * @OA\Property(property="mobile",format="string",description="电话",example=""),
     */
    public function rules(): array
    {
        $user = auth('sanctum')->user();
        return [
            'nickname' => ['required'],
            'avatar' => ['required'],
            'mobile' => ['required','mobile','unique:users,mobile,'.$user->id],
        ];
    }


    public function messages(): array
    {
        return [
            'nickname.required'=>'昵称不能为空!',
            'avatar.required'=>'头像不能为空!',
            'mobile.required'=>'手机号不能为空!',
            'mobile.mobile'=>'手机号规则不正确!',
            'mobile.unique'=>'此手机号已存在!',
        ];
    }
}
